#pragma once    
#include"Tcpserver.hpp"
#include"Handrequest.hpp"
const std::string Sep = "\r\n";
const std::string LineSep = " ";
const std::string BlankLine = Sep;

class Httpserver
{
public:
    Httpserver(int port=gdefault_port):_tcpserver(port)
    {
        _tcpserver.Set_task_server([this](string&data){
        // 2. 完整http反序列化，http response序列化...
        //demo 1 : 直接返回一个固定的内容
        //Handrequest handrequeset(data);
        //handrequeset.Print();

        // std::string status_line = "HTTP/1.1 200 OK" + Sep + BlankLine;
        // // 直接返回一个html网页
        // std::string body = "<!DOCTYPE html>\
        //                     <html>\
        //                    <head>\
        //                    <meta charset = \"UTF-8\">\
        //                    <title> 钟哥是帅b</title>\
        //                    </head>\
        //                    <body>\
        //                    <p> 点击瞎下载</ p>\
        //                    <a class=\"min\"  href=\"https://ys.mihoyo.com//\" target=\"_blank\">免费下载黄片</a>\
        //                    </body> </html>";
        
        // std::string httpresponse = status_line + body;
        // this->_tcpserver.Get_socket()->Send(httpresponse);
        // });
        // _tcpserver.Server_start();
        
        });
        this->_tcpserver.Server_start();
    }
private:
    Tcp_server _tcpserver;
};
